package cloud.estate.owner.service.controller;

import cloud.estate.commons.bean.Owner;
import cloud.estate.commons.util.JsonResult;
import cloud.estate.owner.service.ownerService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/owner")
public class ownerController {
    @Resource
    private ownerService ownerService;
    @PostMapping("/addOneOwner")
    public JsonResult addOneOwner(Owner owner){
        return ownerService.addOneOwner(owner);
    }
    @PostMapping("/deleteOneOwner")
    public JsonResult deleteOneOwner(String id){
        return ownerService.deleteOneOwner(id);
    }
    @PostMapping("/updateOneOwner")
    public JsonResult updateOneOwner(Owner owner){
        return ownerService.updateOneOwner(owner);
    }
    @GetMapping("/getOneOwner")
    public JsonResult getOneOwner(String id){
        return ownerService.getOneOwner(id);
    }
    @GetMapping("/listAllOwner")
    public JsonResult listAllOwner(){
        return ownerService.listAllOwner();
    }
}
